package aceona.api.weibo.sina.demo;

import weibo4j.Weibo;
import weibo4j.model.PostParameter;
import weibo4j.org.json.JSONObject;
import aceona.api.weibo.sina.ApiToken;

public class Demo {
	//首次运行前请先设置 ApiToken.ACCESS_TOKEN
	public static void main(String[] args) throws Exception {
		//中国001   贵州001052  贵阳001052001
		String apiUrl = Api.USER_GET_2;
		Weibo weibo = new Weibo();
		weibo.setToken(ApiToken.ACCESS_TOKEN);
		//打印json字串
		JSONObject api = WeiBoTools.getAsJSONObject(apiUrl,new PostParameter[]{ new PostParameter("domain", "jeraywu")});//带参数形式
//		JSONObject api = WeiBoTools.getAsJSONObject(apiUrl);//不带参数形式
		System.out.println(api.toString());
		
		//打印json数组
//		JSONArray api = WeiBoTools.getAsJSONArray(apiUrl);
//		System.out.println("JSON Array Capacity: " + api.length());
//		if(api.length() > 0){
//			for(int i = 0, len = api.length(); i < len; i++){
//				System.out.println(api.getJSONArray(i));
//			}
//		}
	}
}
